
#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QGraphicsPixmapItem>//图形元素
#include <QGraphicsView>//视图
#include <QGraphicsScene>//场景
#include <QRect>
#include <QColor>
#include <QGraphicsTextItem>
#include <QString>
#include <QDebug>
#include <QGraphicsBlurEffect>
#include <QPushButton>
#include <QPropertyAnimation>
#include <QTimer>
#include <QToolButton>
#include <QGraphicsVideoItem>
#include <QMediaPlayer>
#include <QUrl>
#include "musicscore.h"
#include <QFile>
#include <QKeyEvent>

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget

{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

    void judgeStatus();
    void ShowStatus();

    virtual void keyPressEvent(QKeyEvent* event);
    virtual void keyReleaseEvent(QKeyEvent* event);
private:
    Ui::Widget *ui;

    MusicScore *mMS;//谱面

    QGraphicsView mGameView;//游戏主视图
    QGraphicsScene mStartScene;//游戏开始场景
    QGraphicsScene mScene; //游戏主场景

    QGraphicsPixmapItem mBackground;//游戏背景
    QGraphicsPixmapItem mTrack1;//设置四个轨道
    QGraphicsPixmapItem mTrack2;
    QGraphicsPixmapItem mTrack3;
    QGraphicsPixmapItem mTrack4;
    QGraphicsPixmapItem mStartBackground;//开始界面背景
    QGraphicsPixmapItem mTitle1;//标题
    QGraphicsPixmapItem mTitle2;
    QPushButton *mTitle3;

    //QGraphicsVideoItem gif1;
    //QGraphicsVideoItem gif2;

   // QMediaPlayer player;


    //以后封装到谱面类中去
    int Score = 300;//游戏得分
    //int Acc = 20;//准度*10000
    int ComboNum = 12;//连击数
    QGraphicsTextItem *mScore;
    //QGraphicsTextItem *mAcc;
    QGraphicsTextItem *mLv;//谱面难度
    QGraphicsTextItem *mPName;//谱面名字
    QGraphicsTextItem *mCombo = new QGraphicsTextItem("Combo");
    QGraphicsTextItem *mComboNum;//连击数
    QGraphicsTextItem *mStatus;//Perfect Good Bad Miss

    //按键组合
    QList<int> mKeyList;

    //计时器
    QTimer *mMSTimer;//谱面移动计时器
    QTimer *mDelay;//开始前缓冲计时器
    QTimer *mDetectKeyTimer;//检测按键计时器
    QTimer *mBorder;//边界判定计时器
};

#endif // WIDGET_H
